<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <common-head></common-head>
  </div>
  <script src="./vue.global.js"></script>
  <script>
    const { createApp } = Vue;
    const app = createApp();
    const ChildPage = {
      template: `
        <div>
          <header>
            <slot name="header"></slot>  
          </header>
          <main>
            <slot></slot>  
          </main>
          <footer>
            <slot name="foot"></slot>  
          </footer>  
        </div>
      `
    }
    const CommonHead =  {
      template: `
        <div>
          <h2>父组件组件</h2>  
          <child-page>
            <div>哈哈哈哈</div>
            <template #foot>
              <h4>这是尾部</h4>
            </template>
            <template v-slot:header>
              <h4>这是头</h4>
            </template>
            
          </child-page>
          
        </div>
      `,
      components: {
        ChildPage
      }
    }
    app.component('CommonHead', CommonHead)

    app.mount('#app')
  </script>
</body>
</html>